// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_HR_PERSON_POSITION
// * CreateDate    : 2012/1/4 10:06:46
// * Creater       : CodeSmith
// * LastChangeDate: 2012/1/4 10:06:46
// * LastChanger   : 2012/1/4 10:06:46
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Hr
{
/// <summary>
    /// HrPersonPosition
    /// </summary>
    public partial class HrPersonPositionBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objHrPersonPositionEntity">Entity</param>
        /// <returns>Entity</returns>
        public static HrPersonPositionEntity GetHrPersonPosition(HrPersonPositionEntity objHrPersonPositionEntity)
        {
            return DataAccess.SelectSingle<HrPersonPositionEntity>(objHrPersonPositionEntity);
        }
        public static DataSet GetPersonPositionById(string personId)
        {
            string sql = @"SELECT PP.*, PS.POSITION_NAME, P.NAME_CN AS SUPERVISOR_NAME
                            FROM HR_PERSON_POSITION PP
                            LEFT JOIN MST_POSITION PS ON PS.POSITION_ID = PP.POSITION_ID
                            LEFT JOIN MST_PERSON P ON P.PERSON_ID = PP.SUPERVISOR
                            WHERE PP.PERSON_ID = '" + personId + "'";
            return DataAccess.SelectDataSet(sql);
        }
        public static HrPersonPositionEntity GetById(string personId, string positionId)
        {
            if (string.IsNullOrEmpty(personId) || string.IsNullOrEmpty(positionId))
            {
                return null;
            }
            HrPersonPositionEntity entity = new HrPersonPositionEntity();
            entity.PersonId = personId;
            entity.PositionId = positionId;
            return DataAccess.SelectSingle<HrPersonPositionEntity>(entity);
        }
        #endregion

        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objHrPersonPositionEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertHrPersonPosition(HrPersonPositionEntity objHrPersonPositionEntity)
        {
            return DataAccess.Insert(objHrPersonPositionEntity);
        }

        public static bool InsertHrPersonPosition(List<HrPersonPositionEntity> objHrPersonPositionEntityList)
        {
            return DataAccess.Insert(objHrPersonPositionEntityList);
        }
        #endregion

        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objHrPersonPositionEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdateHrPersonPosition(HrPersonPositionEntity objHrPersonPositionEntity)
        {
            return DataAccess.Update(objHrPersonPositionEntity);
        }

        public static bool UpdateHrPersonPosition(List<HrPersonPositionEntity> objHrPersonPositionEntityList)
        {
            return DataAccess.Update<HrPersonPositionEntity>(objHrPersonPositionEntityList);
        }
        #endregion

        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objHrPersonPositionEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeleteHrPersonPosition(HrPersonPositionEntity objHrPersonPositionEntity)
        {
            return DataAccess.Delete(objHrPersonPositionEntity);
        }

        public static bool DeleteHrPersonPosition(List<HrPersonPositionEntity> objHrPersonPositionEntityList)
        {
            return DataAccess.Delete<HrPersonPositionEntity>(objHrPersonPositionEntityList);
        }
        #endregion

        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetHrPersonPositionAll()
        {
            return DataAccess.SelectAllDataSet<HrPersonPositionEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<HrPersonPositionEntity> GetHrPersonPositionAllList()
        {
            return DataAccess.SelectAll<HrPersonPositionEntity>();
        }
        #endregion
	}
	
	
}	

